// pages/activitydata/activityindex.js
const app = getApp()
var CONFIG = require("../../config/config.js");
var share = require('../../utils/share.js');
Page({

    /**
     * 页面的初始数据
     */
    data: {
        errcode:-1,
        dataarr:[],
        consultant_id:'',
    },

    clickdec(e){
        var that = this;
        var item = e.currentTarget.dataset.item || e.target.dataset.item;
        wx.navigateTo({
            url: '/pages/activitydata/activitylist?id='+item.id+'&consultant_id='+that.data.consultant_id+'',
        })
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var that = this;
        that.setData({
            consultant_id:app.globalData.admin_id
        })
        that.dataList();
    },

    dataList(){
        var that = this;
        wx.showLoading({
            title: '加载中~',
        })
        var data = {
            consultant_id:that.data.consultant_id
            
        }
        share.wxRequest('crmapi/DataHandling/dataList',data,function(res){
            if (Number(res.data.errcode) == 0) {
                var data = res.data.data;
                that.setData({
                    dataarr:data,
                })
            }
            that.setData({
                errcode:1,
            })
            wx.hideLoading();
        })
    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        var that = this;
        if(Number(that.data.errcode)>=0){
            that.dataList();
        }
    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})